#pragma once

#include "my_log.h"

static inline int
my_cpu_num() {
    int res = (int)sysconf(_SC_NPROCESSORS_ONLN);
    if (res <= 0) {
        MY_LOG_FATAL("get cpu num failed");
    }

    return res;
}

static inline int
my_cache_line() {
    int res = (int)sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
    if (res <= 0) {
        MY_LOG_FATAL("get cache line failed");
    }

    return res;
}